home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / DEV / A-B / 606+gest.cpt / SoundInput.p < prev   
Text File  |  1990-10-17  |  8KB  |  197 lines

  1. {    This file has been processed by The THINK Pascal Source Converter, v1.1.    }
  2. {}
  3. {    Copyright © Symantec Corporation 1990}
  4. {    Copyright Apple Computer, Inc. 1985-1990}
  5. {    All rights reserved.}
  6. {}
  7. {}
  8. {    File:        SoundInput.p}
  9. {}
  10. {Converted from the 6.0.6  beta 19 interfaces -MYG }
  11.  
  12. unit SoundInput;
  13. interface
  14.  
  15.  
  16.     const
  17.  
  18. {Error codes}
  19.  
  20.         siNoSoundInHardware = -220;            { ••• not used anywhere! }
  21.         siBadSoundInDevice = -221;            { invalid index passed to SoundInGetIndexedDevice }
  22.         siNoBufferSpecified = -222;            { returned by synchronous SPBRecord if nil buffer passed }
  23.         siInvalidCompression = -223;            { invalid compression type }
  24.         siHardDriveTooSlow = -224;            { hard drive too slow to record to disk }
  25.         siInvalidSampleRate = -225;            { invalid sample rate }
  26.         siInvalidSampleSize = -226;            { invalid sample size }
  27.         siDeviceBusyErr = -227;            { input device already in use }
  28.         siBadDeviceName = -228;            { input device could not be opened }
  29.         siBadRefNum = -229;            { invalid input device reference number }
  30.         siInputDeviceErr = -230;            { input device hardware failure }
  31.         siUnknownInfoType = -231;            { invalid info type selector (returned by driver) }
  32.         siUnknownQuality = -232;            { invalid quality selector (returned by driver) }
  33.  
  34.         siDeviceIsConnected = 1;                { input device is connected and ready for input }
  35.         siDeviceNotConnected = 0;                { input device is not connected }
  36.         siDontKnowIfConnected = -1;                { can't tell if input device is connected }
  37.  
  38.         siReadPermission = 0;                { permission passed to SPBOpenDevice }
  39.         siWritePermission = 1;                { permission passed to SPBOpenDevice }
  40.  
  41. { Info Selectors for Sound Input Drivers }
  42.  
  43.         siDeviceConnected = 'dcon';            { input device connection status }
  44.         siRTFOnOff = 'rtf ';            { record to file state }
  45.         siAGCOnOff = 'agc ';            { automatic gain control state }
  46.         siPlayThruOnOff = 'plth';            { playthrough state }
  47.         siTwosComplementOnOff = 'twos';            { two's complement state }
  48.         siLevelMeterOnOff = 'lmet';            { level meter state }
  49.         siPauseRecording = 'paus';            { recording paused state }
  50.         siRecordingQuality = 'qual';            { recording quality }
  51.         siVoxRecordInfo = 'voxr';            { VOX record parameters }
  52.         siVoxStopInfo = 'voxs';            { VOX stop parameters }
  53.         siNumberChannels = 'chan';            { current number of channels }
  54.         siSampleSize = 'ssiz';            { current sample size }
  55.         siSampleRate = 'srat';            { current sample rate }
  56.         siCompressionType = 'comp';            { current compression type }
  57.         siCompressionFactor = 'cmfa';            { current compression factor }
  58.         siCompressionHeader = 'cmhd';            { return compression header }
  59.         siUserInterruptProc = 'user';            { user interrupt routine }
  60.         siDeviceName = 'name';            { input device name }
  61.         siDeviceIcon = 'icon';            { input device icon }
  62.         siDeviceBufferInfo = 'dbin';            { size of interrupt buffer }
  63.         siSampleSizeAvailable = 'ssav';            { sample sizes available }
  64.         siSampleRateAvailable = 'srav';            { sample rates available }
  65.         siCompressionAvailable = 'cmav';            { compression types available }
  66.         siChannelAvailable = 'chav';            { number of channels available }
  67.         siInitializeDriver = 'init';            { initialize driver }
  68.         siCloseDriver = 'clos';            { close driver }
  69.         siAsync = 'asyn';            { asynchronous capability }
  70.         siOptionsDialog = 'optd';            { display options dialog }
  71.  
  72. { Qualities }
  73.  
  74.         siBestQuality = 'best';
  75.         siBetterQuality = 'betr';
  76.         siGoodQuality = 'good';
  77.  
  78.  
  79. { Function selectors for the Sound Input calls }
  80.  
  81.         siToolNum = 20;                { tool number of Sound Input Manager }
  82.         siMOVEL = $203C;            { MOVEI.L    #selector,D0 }
  83.  
  84.         siVersion = (0 * 256) + 0;
  85.         siSndRecord = (8 * 256) + 4;
  86.         siSignInDevice = (3 * 256) + 12;
  87.         siSignOutDevice = (1 * 256) + 16;
  88.         siGetIndexedDevice = (5 * 256) + 20;
  89.         siOpenDevice = (5 * 256) + 24;
  90.         siCloseDevice = (2 * 256) + 28;
  91.         siRecord = (3 * 256) + 32;
  92.         siPauseRecordingR = (2 * 256) + 40;
  93.         siResumeRecording = (2 * 256) + 44;
  94.         siStopRecording = (2 * 256) + 48;
  95.         siGetRecordingStatus = (14 * 256) + 52;
  96.         siGetDeviceInfo = (6 * 256) + 56;
  97.         siSetDeviceInfo = (6 * 256) + 60;
  98.         siMilliSecondsToBytes = (4 * 256) + 64;
  99.         siBytesToMilliSeconds = (4 * 256) + 68;
  100.         siSetupSndHeader = (13 * 256) + 72;
  101.         siSetupAIFFHeader = (11 * 256) + 76;
  102.  
  103.  
  104.     type
  105.  
  106.         SPBPtr = ^SPB;
  107.         SPB = record
  108.                 inRefNum: LONGINT;            { reference number of sound input device }
  109.                 count: LONGINT;            { number of bytes to record }
  110.                 milliseconds: LONGINT;            { number of milliseconds to record }
  111.                 bufferLength: LONGINT;            { length of buffer in bytes }
  112.                 bufferPtr: Ptr;                { buffer to store sound data in }
  113.                 completionRoutine: ProcPtr;            { completion routine }
  114.                 interruptRoutine: ProcPtr;            { interrupt routine }
  115.                 userLong: LONGINT;            { user-defined field }
  116.                 error: OSErr;                { error }
  117.                 unused1: LONGINT;            { reserved - must be zero }
  118.             end;
  119.  
  120.  
  121.     function SPBVersion: LONGINT;
  122.     inline
  123.         siMOVEL, siVersion, siToolNum, $A800;
  124.  
  125.     function SndRecord (filterProc: ProcPtr; corner: Point; quality: OSType; var sndHandle: Handle): OSErr;
  126.     inline
  127.         siMOVEL, siSndRecord, siToolNum, $A800;
  128.  
  129.     function SPBSignInDevice (deviceRefNum: INTEGER; deviceName: Str255): OSErr;
  130.     inline
  131.         siMOVEL, siSignInDevice, siToolNum, $A800;
  132.  
  133.     function SPBSignOutDevice (deviceRefNum: INTEGER): OSErr;
  134.     inline
  135.         siMOVEL, siSignOutDevice, siToolNum, $A800;
  136.  
  137.     function SPBGetIndexedDevice (count: INTEGER; var deviceName: Str255; var deviceIconHandle: Handle): OSErr;
  138.     inline
  139.         siMOVEL, siGetIndexedDevice, siToolNum, $A800;
  140.  
  141.     function SPBOpenDevice (deviceName: Str255; permission: INTEGER; var inRefNum: LONGINT): OSErr;
  142.     inline
  143.         siMOVEL, siOpenDevice, siToolNum, $A800;
  144.  
  145.     function SPBCloseDevice (inRefNum: LONGINT): OSErr;
  146.     inline
  147.         siMOVEL, siCloseDevice, siToolNum, $A800;
  148.  
  149.     function SPBRecord (inParamPtr: SPBPtr; asynchFlag: BOOLEAN): OSErr;
  150.     inline
  151.         siMOVEL, siRecord, siToolNum, $A800;
  152.  
  153.     function SPBPauseRecording (inRefNum: LONGINT): OSErr;
  154.     inline
  155.         siMOVEL, siPauseRecordingR, siToolNum, $A800;
  156.  
  157.     function SPBResumeRecording (inRefNum: LONGINT): OSErr;
  158.     inline
  159.         siMOVEL, siResumeRecording, siToolNum, $A800;
  160.  
  161.     function SPBStopRecording (inRefNum: LONGINT): OSErr;
  162.     inline
  163.         siMOVEL, siStopRecording, siToolNum, $A800;
  164.  
  165.     function SPBGetRecordingStatus (inRefNum: LONGINT; var recordingStatus: INTEGER; var meterLevel: INTEGER; var totalSamplesToRecord: LONGINT; var numberOfSamplesRecorded: LONGINT; var totalMsecsToRecord: LONGINT; var numberOfMsecsRecorded: LONGINT): OSErr;
  166.     inline
  167.         siMOVEL, siGetRecordingStatus, siToolNum, $A800;
  168.  
  169.     function SPBGetDeviceInfo (inRefNum: LONGINT; infoType: OSType; infoData: Ptr): OSErr;
  170.     inline
  171.         siMOVEL, siGetDeviceInfo, siToolNum, $A800;
  172.  
  173.     function SPBSetDeviceInfo (inRefNum: LONGINT; infoType: OSType; infoData: Ptr): OSErr;
  174.     inline
  175.         siMOVEL, siSetDeviceInfo, siToolNum, $A800;
  176.  
  177.     function SPBMilliSecondsToBytes (inRefNum: LONGINT; var milliSeconds: LONGINT): OSErr;
  178.     inline
  179.         siMOVEL, siMilliSecondsToBytes, siToolNum, $A800;
  180.  
  181.     function SPBBytesToMilliSeconds (inRefNum: LONGINT; var byteCount: LONGINT): OSErr;
  182.     inline
  183.         siMOVEL, siBytesToMilliSeconds, siToolNum, $A800;
  184.  
  185.     function SetupSndHeader (sndHandle: Handle; numChannels: INTEGER; sampleRate: Fixed; sampleSize: INTEGER; compressionType: OSType; baseNote: INTEGER; numBytes: LONGINT; var headerLen: INTEGER): OSErr;
  186.     inline
  187.         siMOVEL, siSetupSndHeader, siToolNum, $A800;
  188.  
  189.     function SetupAIFFHeader (fRefNum: INTEGER; numChannels: INTEGER; sampleRate: Fixed; sampleSize: INTEGER; compressionType: OSType; numBytes: LONGINT; numFrames: LONGINT): OSErr;
  190.     inline
  191.         siMOVEL, siSetupAIFFHeader, siToolNum, $A800;
  192.  
  193.     { UsingSoundInput }
  194.  
  195.  
  196. implementation
  197. end.